/**
 * Generali Solutions d'assurances - Tous droits réservés &copy; 2007 - 2010
 */

package fr.generali.accueilclient.opt.detailcampagne.builder;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import fr.generali.accueilclient.opt.detailcampagne.om.ICampagneDetailCamp;
import fr.generali.accueilclient.opt.detailcampagne.om.IFamilleProduitDetailCamp;
import fr.generali.accueilclient.opt.detailcampagne.om.IObjectifsDetailCamp;
import fr.generali.accueilclient.opt.detailcampagne.om.IOffreCommercialeDetailCamp;
import fr.generali.accueilclient.opt.detailcampagne.om.impl.DTOCampagneDetailCamp;

/**
 * @author Holmes Kelly
 */
public class DTOCampagneDetailCampBuilder extends DTOCampagneDetailCampBuilderBase<DTOCampagneDetailCampBuilder> {

    /**
     * constructeur
     */
    public DTOCampagneDetailCampBuilder() {
        super(new DTOCampagneDetailCamp());
    }

    /**
     * @return DTOCampagneDetailCampBuilder
     */
    public static DTOCampagneDetailCampBuilder dTOCampagneDetailCamp() {
        return new DTOCampagneDetailCampBuilder();
    }

    /**
     * @return DTOCampagneDetailCamp
     */
    public ICampagneDetailCamp build() {
        return getInstance();
    }
}

/**
 * @author Holmes Kelly
 * @param <GeneratorT>
 */
class DTOCampagneDetailCampBuilderBase<GeneratorT extends DTOCampagneDetailCampBuilderBase<GeneratorT>> {

    /**
     * instance
     */
    private ICampagneDetailCamp instance;

    /**
     * @param aInstance instance
     */
    protected DTOCampagneDetailCampBuilderBase(ICampagneDetailCamp aInstance) {
        instance = aInstance;
    }

    /**
     * @return instance
     */
    protected ICampagneDetailCamp getInstance() {
        return instance;
    }

    /**
     * @param aValue identifiant
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildIdentifiant(String aValue) {
        instance.setIdentifiant(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue nom
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildNom(String aValue) {
        instance.setNom(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue libelle type
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildLibelleTypeCampagne(String aValue) {
        instance.setLibelleTypeCampagne(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue description
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildDescription(String aValue) {
        instance.setDescription(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue start date
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildStartDate(Date aValue) {
        instance.setStartDate(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue end date
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildEndDate(Date aValue) {
        instance.setEndDate(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue nb executions
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildNbExecutions(BigInteger aValue) {
        instance.setNbExecutions(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue code campagne affinum
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildCodeCampagneAffinium(String aValue) {
        instance.setCodeCampagneAffinium(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue code segment
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildCodeSegment(String aValue) {
        instance.setCodeSegment(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue libelle media
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildLibelleMedia(String aValue) {
        instance.setLibelleMedia(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue libelle statut campagne
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildLibelleStatutCampagne(String aValue) {
        instance.setLibelleStatutCampagne(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue categorie
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildCategorie(String aValue) {
        instance.setCategorie(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue marche
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildMarche(String aValue) {
        instance.setMarche(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue liste offre
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildOffres(List<IOffreCommercialeDetailCamp> aValue) {
        instance.setOffres(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue add element to liste Offre
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildAddedOffre(IOffreCommercialeDetailCamp aValue) {
        if (instance.getOffres() == null) {
            instance.setOffres(new ArrayList<IOffreCommercialeDetailCamp>());
        }

        ((ArrayList<IOffreCommercialeDetailCamp> ) instance.getOffres()).add(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue liste famille
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildFamille(List<IFamilleProduitDetailCamp> aValue) {
        instance.setFamille(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue add element to liste famille
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildAddedFamilleElement(IFamilleProduitDetailCamp aValue) {
        if (instance.getFamille() == null) {
            instance.setFamille(new ArrayList<IFamilleProduitDetailCamp>());
        }

        ((ArrayList<IFamilleProduitDetailCamp> ) instance.getFamille()).add(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue liste objectifs
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildObjectifs(List<IObjectifsDetailCamp> aValue) {
        instance.setObjectifs(aValue);

        return (GeneratorT ) this;
    }

    /**
     * @param aValue add element to liste objectifs
     * @return GeneratorT
     */
    @SuppressWarnings("unchecked")
    public GeneratorT buildAddedObjectif(IObjectifsDetailCamp aValue) {
        if (instance.getObjectifs() == null) {
            instance.setObjectifs(new ArrayList<IObjectifsDetailCamp>());
        }

        ((ArrayList<IObjectifsDetailCamp> ) instance.getObjectifs()).add(aValue);

        return (GeneratorT ) this;
    }
}
